<html>
<head>
	<link rel="stylesheet" href="css/eggplant/jquery-ui-1.8.18.custom.css" type="text/css">
	<link rel="stylesheet" href="css/studentvoice.css" type="text/css">
	<script src="js/jquery-1.7.2.min.js" type="text/javascript" ></script>
	<script src="js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
	<script src="js/studentvoice.js" type="text/javascript"></script>
</head>
<body>
<form class="centered400" method="post" action="http://">
	<div id="testcontainer"></div>
	<button type="submit">Submit</button>
</form>
<script>
	/** format of the test:
	var data = [ {
		name:
		text:
		answers: [ {
			text:
			value:
			},
			... ]
		},
		...
	]
	*/
	var drawTest = function (testdata) {
		var container = jQuery('#testcontainer');
		for (var i in testdata) {
			var question = testdata[i];

			var element = $('<div />').appendTo(container);

			var text = $('<div />').text(question.text).appendTo(element);
			var answers = $('<div />').appendTo(element);
			for (var j in question.answers) {
				var answer = question.answers[j];
				var div = $('<div />').appendTo(answers);
				var answerElement = jQuery('<input />')/*.attr('name', question.name)*/.attr('type', 'radio').val(answer.text).appendTo(div);
				div.append(answer.text);
			}
		}
	};

	jQuery(function () {
//		StudentVoice.getTestData(id, drawTest);
		StudentVoice.getTestData(0, drawTest);
	});
</script>
</body>
</html>
